class Dine < ActiveRecord::Base
  belongs_to :event
  has_many :tables,:dependent=>:destroy
  has_many :top_tables,:class_name=>"TopTable",:dependent=>:destroy
  has_many :normal_tables,:class_name=>"NormalTable",:dependent=>:destroy

  def worker
    begin
      @conventioner=Conventioner.find(self.conventioner_id)
    rescue
      @conventioner=nil
    end
    @conventioner
  end

  def eaters
    eaters=[]
    self.tables.each do |table|
      eaters+=table.eaters.split(',')
    end
    eaters
  end
end
